using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using TodoList.Data;
using TodoList.Shared;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSwaggerGen(c =>
{
	c.UseApiEndpoints();
});
builder.Services.AddControllers(options =>
{
	options.UseNamespaceRouteToken();
});
builder.Services.Configure<ApiBehaviorOptions>(options =>
{
	options.SuppressInferBindingSourcesForParameters = true;
});
builder.Services.AddDbContext<ApplicationDbContext>(options =>
	options.UseInMemoryDatabase("TodoList"));
var app = builder.Build();
app.MakeSureDbCreated();
app.UseSwaggerWithUi();
app.MapControllers();
app.UseHttpsRedirection();
app.Run();

